project(LibUTSCKernel)
if (MSVC)
    add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
endif ()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/out/build/OpenUTSC/LibUTSCKernel)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/out/build/OpenUTSC/LibUTSCKernel)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/out/build/OpenUTSC/LibUTSCKernel)


set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

include_directories("${CMAKE_SOURCE_DIR}/LibUTSCBase")

file(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
add_library(LibUTSCKernel SHARED ${SOURCE_FILES}
        IUTSCKernel.hpp
        LibUTSCKernel.cpp
        UTSCImpl.cpp
        UTSCImpl.hpp
)


set(ISEXTRACT OFF)
if(ISEXTRACT)
    set(lib_output_directory ${CMAKE_OUT_DIR}/out/LibUTSCKernel)
    set(lib_install_directory ${CMAKE_SOURCE_DIR}/out/LibUTSCKernel)
    if (CMAKE_BUILD_TYPE STREQUAL "Debug")
        file(COPY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/LibUTSCKernel_d.lib DESTINATION ${lib_output_directory}/lib)
        file(COPY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/LibUTSCKernel_d.dll DESTINATION ${lib_output_directory}/bin)
    else ()
        file(COPY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/LibUTSCKernel_r.lib DESTINATION ${lib_output_directory}/lib)
        file(COPY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/LibUTSCKernel_r.dll DESTINATION ${lib_output_directory}/bin)
    endif ()
endif ()
